xquery version "1.0";

<results>
{     
    for $deptEmp in
        doc("deptEmp.xml")
        //demployee
       
    let 
        $dept_no := $deptEmp/dept_no
        
    where
        $dept_no  = "d0001"
  order by
 $deptEmp/to_date
    return
        <id_dept_no>
        { 
            ($deptEmp/from_date ,emp_no, to_date, $dept_no)
        }        
        </id_dept_no>
}
</results>